﻿using System.Collections.Generic;
using System.Data;
using Ledict.ConditionExtract.DAL;
using Ledict.ConditionExtract.Model;

namespace Ledict.ConditionExtract.BLL
{
    /// <summary>
    /// 诉请种类和要素关系配置逻辑类
    /// </summary>
    public class XmlLabel_SuitTypeRelBLL
    {
        readonly XmlLabel_SuitTypeRelDAL _suitTypedal = new XmlLabel_SuitTypeRelDAL();

        /// <summary>
        /// 获得诉请种类数据列表，根据情形情节ID
        /// </summary>
        /// <param name="ccId">情形情节ID</param>
        /// <param name="searchWords">查询关键词</param>
        public DataTable GetSuitTypeList(string ccId, string searchWords = "")
        {
            return _suitTypedal.GetSuitTypeList(ccId, searchWords);
        }

        /// <summary>
        /// 获得诉请种类与各要素关系数据列表，根据诉请种类ID
        /// </summary>
        /// <param name="stId">诉请种类ID</param>
        public DataTable GetSuitTypeRelList(string stId)
        {
            return _suitTypedal.GetSuitTypeRelList(stId);
        }

        /// <summary>
        /// 批量添加
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        public bool BatchAdd(IList<SYS_XmlLabel_SuitTypeRel> list)
        {
            return _suitTypedal.BatchAdd(list);
        }

        /// <summary>
        /// 获得诉请种类关系数据列表，根据情形情节ID
        /// </summary>
        /// <param name="ccId">情形情节ID</param>
        /// <param name="labelType">标签类型</param>
        /// <param name="isLabelPathDistinct">是否标签路径去重</param>
        public DataTable GetSuitTypeRelListByCcid(string ccId, string labelType = null, bool isLabelPathDistinct = false)
        {
            return _suitTypedal.GetSuitTypeRelListByCcid(ccId, labelType, isLabelPathDistinct);
        }

        /// <summary>
        /// 批量删除节点
        /// </summary>
        /// <param name="idList">主键ID列表</param>
        /// <returns></returns>
        public int DeleteBatchByXSR_ID(IList<string> idList)
        {
            return _suitTypedal.DeleteBatchByXSR_ID(idList);

        }

        /// <summary>
        /// 修改指定ID下的显示顺序
        /// </summary>
        /// <param name="xsrId">主键</param>
        /// <param name="index">显示顺序</param>
        /// <returns></returns>
        public int UpdateIndex(string xsrId, string index)
        {
            return _suitTypedal.UpdateIndex(xsrId, index);
        }

        /// <summary>
        /// 修改指定ID下的XPath标签路径
        /// </summary>
        /// <param name="xsrId">主键</param>
        /// <param name="xPath">XPath标签路径</param>
        /// <returns></returns>
        public int UpdateXPath(string xsrId, string xPath)
        {
            return _suitTypedal.UpdateXPath(xsrId, xPath);
        }

        /// <summary>
        /// 修改指定ID下的显示顺序，xpath标签路径
        /// </summary>
        /// <param name="xsrId">ID</param>
        /// <param name="xPath">标签路径</param>
        /// <param name="index">显示顺序</param>
        /// <returns></returns>
        public int UpdateIndexAndXPath(string xsrId, string xPath, string index)
        {
            return _suitTypedal.UpdateIndexAndXPath(xsrId, xPath, index);
        }

        /// <summary>
        /// 修改指定情形情节ID下的同一种诉请要素种类下，同一个标签路径的显示顺序
        /// </summary>
        /// <param name="labelType">诉请要素类型</param>
        /// <param name="index">显示顺序</param>
        /// <param name="ccid">情形情节ID</param>
        /// <param name="labelPath">标签路径</param>
        /// <returns>影响行数</returns>
        public int UpdateIndex(string ccid, string labelPath, string labelType, int index)
        {
            return _suitTypedal.UpdateIndex(ccid, labelPath, labelType, index);
        }

        /// <summary>
        /// 修改指定ID下的是否显示标签
        /// </summary>
        /// <param name="xsrId">主键</param>
        /// <param name="isShowLabel">是否显示标签</param>
        /// <returns></returns>
        public int UpdateIsShowLabel(string xsrId, bool isShowLabel)
        {
            return _suitTypedal.UpdateIsShowLabel(xsrId, isShowLabel);
        }
    }
}
